Refactoring via program slicing and sliding

نویسنده

  • Ran Ettinger
چکیده

Mark Weiser’s observation that “programmers use slices when debugging”, back in 1982, started a new field of research. Program slicing, the study of meaningful subprograms that capture a subset of an existing program’s behaviour, aims at providing programmers with tools to assist in a variety of software development and maintenance activities. Two decades later, the work leading to this thesis was initiated with the observation that “programmers use slices when refactoring”. Hence, the thesis explores ways in which known refactoring techniques can be automated through slicing and related program analyses. Common to all slicing related refactorings, as explored in this thesis, is the goal of improving reusability, comprehensibility and hence maintainability of existing code. A problem of slice extraction is posed and its potential contribution to refactoring research highlighted. Limitations of existing slice-extraction solutions include low applicability and high levels of code duplication. Advanced techniques for the automation of slice extraction are proposed. The key to their success lies in a novel program representation introduced in the thesis. We think of a program as a collection of transparency slides, placed one on top of the other. On each such slide, a subset of the original statement, not necessarily a contiguous one, is printed. Thus, a subset of a statement’s slides can be extracted from the remaining slides in an operation of sideways movement, called sliding. Semantic properties of such sliding operations are extensively studied through known techniques of predicate calculus and program semantics. This thesis makes four significant contributions to the slicing and refactoring fields of research. Firstly, it develops a theoretical framework for slicing-based behaviour-preserving transformations of existing code. Secondly, it provides a provably correct slicing algorithm. This application of our theory acts as evidence for its expressive power whilst enabling constructive descriptions of slicingbased transformations. Thirdly, it applies the above framework and slicing algorithm in solving the problem of slice extraction. The solution, a family of provably correct sliding transformations, provides high levels of accuracy and applicability. Finally, the thesis outlines the application of sliding to known refactorings, making them automatable for the first time. These contributions provide strong evidence that, indeed, slicing and related analyses can assist in building automatic tools for refactoring. To Dana, Amir, Zohara and Ze’ev; and to loved Bärbel.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Seminar Program Analysis and Transformation Program Slicing and Sliding for Refactoring

Slicing is an approach to divide a program into chunks that share a common property, like their contribution to the result of a calculation. Slicing can be used to leverage the power of refactoring tools by providing a deeper understanding of the code. For example, the Extract Method refactoring used to extract a series of statements can—with the aid of a slicing algorithm—be enhanced to allow ...

متن کامل

Program Sliding

As program slicing is a technique for computing a subprogram that preserves a subset of the original program’s functionality, program sliding is a new technique for computing two such subprograms, a slice and its complement, the co-slice. A composition of the slice and co-slice in a sequence is expected to preserve the full functionality of the original code. The co-slice generated by sliding i...

متن کامل

On Choosing Program Refactoring and Slicing Re-engineering Practice Towards Software Quality

The quality of software depends on its maintainability. Software under evolution is modified and enhanced to accommodate new requirements. As a result, the software becomes more complex and deviates from its original design, in turn lowering the quality. Program Slicing and refactoring as program re-engineering approaches, makes software systems maintainable. Effective slicing and refactoring r...

متن کامل

Detecting Refactorable Clones by Slicing Program Dependence Graphs

Code duplication in a program can make understanding and maintenance difficult. The problem can be reduced by detecting duplicated code, refactoring it into a separate procedure, and replacing all the clones by appropriate calls to the new procedure. In this paper, we report on a confirmatory replication of a tool that was used to detect such refactorable clones based on program dependence grap...

متن کامل

ConSIT: A Conditioned Program Slicer

Conditioned slicing is a powerful generalisation of static and dynamic slicing which has applications to many problems in software maintenance and evolution, including re-use, reengineering and program comprehension. However, there has been relatively little work on the implementation of conditioned slicing. Algorithms for implementing conditioned slicing necessarily involve reasoning about the...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006